﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MockPrjTeam2.DAO;
using System.Data;
using MockPrjTeam2.Entity;


namespace MockPrjTeam2.Biz
{
    public class GovOfficeRegionBiz
    {
        private GovOfficeRegionDao govOfficeRegionDao;
        public GovOfficeRegionBiz()
        {
            govOfficeRegionDao = new GovOfficeRegionDao();
        }
        //method GetAllGovOfficeRegion()
        public DataTable GetAll()
        {
            return govOfficeRegionDao.GetAll();
        }
        //method GetGovOfficeRegionActive()
        public DataTable GetActive()
        {
            return govOfficeRegionDao.GetActive();
        }
        //method GetGovOfficeRegionById()
        public GovOfficeRegion GetById(int govOfficeRegionId)
        {
            GovOfficeRegion govOfficeRegion = new GovOfficeRegion();
            DataTable dt = new DataTable();
            dt = GovOfficeRegionDao.Instance.GetById(govOfficeRegionId);
            foreach (DataRow dr in dt.Rows)
            {

                govOfficeRegion.GovtOfficeRegionName = dr["GovtOfficeRegionName"].ToString();
                govOfficeRegion.Description = dr["Description"].ToString();
                govOfficeRegion.CountyID = Convert.ToInt32(dr["CountyID"]);
                govOfficeRegion.CountyName = dr["CountyName"].ToString();
                govOfficeRegion.GovOfficeRegionID = Convert.ToInt32(dr["GovOfficeRegionID"]);
            }
            return govOfficeRegion;
        }
        
        public DataTable StartWithByNames(string startWith,int flag)
        {
            return govOfficeRegionDao.StartWithByNames(startWith, flag);
        }
    }
}
